.\"   $Id: instr.3,v 1.1 2002/03/08 13:51:02 fred Exp $
.\" @(#)instr.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
instr
.XE
.XS4 \n%
.ti 0.2i
instr
.XE4 \}
.TH INSTR 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS"
.SH NAME
instr \- find an occurrence of a string in a string, starting at a
specified character.
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
char \(**instr(s, find, from)
char \(**s, \(**find, from;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIs\fP
Pointer to the string to be searched for the pattern
.TP
\fIfind\fP
Pointer to the string to be found, the pattern
.TP
\fIfrom\fP
Character to be searched backwards before searching for the pattern
.SH DESCRIPTION
\fBinstr\fP searches the first occurrence of the string \fIfind\fP in the string
\fIs\fP, starting its search at the last occurrence of the \fIfrom\fP character
in the string \fIs\fP.
.LP
If either \fIs\fP or \fIfind\fP is \fBNULL\fP, the function returns \fBNULL\fP.
If \fIfrom\fP is \fB(char)0\fP, the pattern is searched from the beginning of
\fIs\fP.
.br
This quite exotic behaviour is useful to search the occurrence of a name in a
string resulting from a flatten, when only a terminal object name is to be
taken into account.
.SH RETURN VALUES
\fBinstr\fP return \fBNULL\fP either if the pattern \fIfind\fP is not present 
in the searched string \fIs\fP, or if one at least of these two string are
\fBNULL\fP.
If the pattern is found, a value different from \fBNULL\fP is returned.
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
/* check for the pattern 'ck' anywhere in the string */
#define contains_ck(name)	instr(name, "ck", '\0')
/* check for the pattern 'ck' in the signal name, not instance ones */
#define isclock(ptsig)		 instr(getsigname(ptsig), "ck", SEPAR)
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR isvdd (3),
.BR isvss (3).


.so man1/alc_bug_report.1

